import Vue from 'Vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
Vue.use(VueResource)
Vue.use(VueRouter)
import './lib/mui/css/mui.min.css'
import router from './router.js'
import app from './App.vue'
import moment from 'moment'
Vue.http.options.root = 'http://192.168.2.15:81/'
Vue.http.options.emulateJSON = true
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
import './lib/mui/css/font.css'
import './lib/mui/js/mui.min.js'
import './js/font.js'

Vue.use(MintUI)
    // 定义全局的过滤器
Vue.filter('dateFormat', function(dataStr, pattern = "YYYY-MM-DD HH:mm:ss") {
    return moment(dataStr).format(pattern)
})
Vue.config.productionTip = false;
//本地存储
/*if (JSON.parse(localStorage.getItem('car'))) {
 var car=JSON.parse(localStorage.getItem('car'))
} else {
 var car=[]
} 查询是否有没有为空*/

//注册vuex
import Vuex from 'vuex'
Vue.use(Vuex)
var store = new Vuex.Store({
    state: {
        url: 'http://192.168.2.7/'
            /*car:car*/ //数组存起来商品数据
    }, //this.$store.state.***  //**state.car 组件中不用this用state */
    mutations: {
        /* addToCar(state,goodsinfo){
          state.car.some(item=>{
            例子
          }    
         localStorage.setItem('car',JSON.stringify(state.car))/**传给localstorage*
  },*/

    },
    //this.$store.commit('方法名字'，按需传递唯一值)
    getters: {
        /* getallcount(state){
             var c=0;
             state.car.forEach(item=>{
               c+=item.count
                例子
             })  
           return c
         },*/

    } //this.$store.getters.**
})
var vm = new Vue({
    el: '#app',
    render: c => c(app),
    router, // 1.4 挂载路由对象到 VM 实例上
    store
})